#ifndef H_MAIN

#define SHORT_PERIOD 5000
#define LONG_PERIOD 10000
#define MAXMINILOG 500
#define COMMANDLENGTH 4 //Currently only allows the first 4 commands to work

/* Definition of modes. These are also used as masks for which commands are allowed */
#define MODE_RECOVER 0x0009
#define MODE_IDLE 0x338E
#define MODE_OPERATION 0x3FFB
#define MODE_AUTONOMOUS 0xC00B

/* Defintion of on board command codes */
#define CMD_IDLE 0x0001
#define CMD_RESET 0x0002
#define CMD_WAKE 0x0004
#define CMD_STATUS 0x0008
#define CMD_ACTION 0x0010
#define CMD_TABLE 0x0020
#define CMD_DELAY 0x0040
#define CMD_DOWNLOAD 0x0080
#define CMD_LOG 0x0100
#define CMD_PHOTO 0x0200
#define CMD_PAYCMD 0x0400
#define CMD_PAYSTAT 0x0800
#define CMD_UPLOAD 0x1000
#define CMD_REFLASH 0x2000

/* Define status variables */
#define SV_COMMAND 0

#define SV_ACT_XPAYNORMAL 50
#define SV_ACT_YPAYNORMAL 51
#define SV_ACT_XPAYUNSAFE 52
#define SV_ACT_YPAYUNSAFE 53
#define SV_ACT_ADCS 54
#define SV_ACT_PSUTEMP 55
#define SV_ACT_CAMERASMART 56
#define SV_ACT_CAMERADUMB 57
#define SV_ACT_SDCARD 58

#define SV_PAYX_PENDING 90
#define SV_PAYX_DATA1 91
#define SV_PAYX_DATA2 92
#define SV_PAYY_PENDING 93
#define SV_PAYY_DATA1 94
#define SV_PAYY_DATA2 95
#define SV_MINILOG 96
#define SV_ADDR1 97 //High byte
#define SV_ADDR2 98 //Low byte
#define SV_TIMEOUT 99

//Global variables for passing commands from interrupts to main function
unsigned int command, argument, significance, commandToken;
unsigned char comsData, commandBuffer[4];

//Global variables for COMS
int mod_rec;
unsigned char mod_status, mod_out;

unsigned char minilog[MAXMINILOG];
int statusVar[100];

#define H_MAIN
#endif /* H_MAIN */
